﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///Paging 的摘要说明
/// </summary>
public class Paging
{

    int pageSize = 10;//每页显示多少条数据
    public int PageSize
    {
        get { return pageSize; }
        set { pageSize = value; }
    }

    int pageIndex = 1;//当前页
    public int PageIndex
    {
        get { return pageIndex; }
        set { pageIndex = value; }
    }

    Int32 pageCount;//总共有多少页
    public Int32 PageCount
    {
        get { return pageCount; }
        set { pageCount = value; }
    }

    Int32 maxCount;//总共有多少行数据
    public Int32 MaxCount
    {
        get { return maxCount; }
        set { maxCount = value; }
    }

    public Paging()
    {
        //int maxCount
        //this.pageIndex = pageIndex;
        //this.pageSize = pageSize;
        //if (maxCount % pageSize == 0)
        //{
        //    pageCount = maxCount / pageSize;
        //}
        //else
        //{
        //    pageCount = maxCount / pageSize + 1;
        //}
	}

    public Int32 GetPageCount()
    {
        if (maxCount % pageSize == 0)
        {
            pageCount = maxCount / pageSize;
        }
        else
        {
            pageCount = maxCount / pageSize + 1;
        }
        return pageCount;

    }
}